home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mastering Microsoft Visual Basic 5
/
Mastering Microsoft Visual Basic 5.ISO
/
sampapps
/
cancelasynch
/
frmclient.frm
< prev
next >
Wrap
Text File
|
1996-11-07
|
4KB
|
138 lines
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "COMCTL32.OCX"
Begin VB.Form frmClient
BackColor = &H80000000&
Caption = "Client"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin ComctlLib.ProgressBar pbClient
Height = 645
Left = 180
TabIndex = 0
Top = 2100
Visible = 0 'False
Width = 1725
_ExtentX = 3043
_ExtentY = 1138
BorderStyle = 1
MouseIcon = "frmClient.frx":0000
End
Begin VB.CommandButton cmdStart
Caption = "&Start"
Default = -1 'True
Height = 525
Left = 1710
TabIndex = 2
Top = 1320
Width = 1245
End
Begin ComctlLib.StatusBar sbClient
Align = 2 'Align Bottom
Height = 435
Left = 0
TabIndex = 1
Top = 2760
Width = 4680
_ExtentX = 8255
_ExtentY = 767
SimpleText = ""
BeginProperty Panels {2C787A51-E01C-11CF-8E74-00A0C90F26F8}
NumPanels = 2
BeginProperty Panel1 {2C787A53-E01C-11CF-8E74-00A0C90F26F8}
Object.Width = 2540
MinWidth = 2540
TextSave = ""
Key = ""
Object.Tag = ""
EndProperty
BeginProperty Panel2 {2C787A53-E01C-11CF-8E74-00A0C90F26F8}
AutoSize = 1
Bevel = 0
Object.Width = 5265
MinWidth = 2540
TextSave = ""
Key = ""
Object.Tag = ""
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MouseIcon = "frmClient.frx":001C
End
End
Attribute VB_Name = "frmClient"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private WithEvents obj As clsAsynch
Attribute obj.VB_VarHelpID = -1
Private Sub cmdStart_Click()
Me.Enabled = False
sbClient.Panels(1).Text = "Working..."
frmCancel.Show
pbClient.Visible = True
obj.SomeAsynchronousTask
End Sub
Private Sub Form_Load()
' Set the parent of the progress bar to be
' the status bar
SetParent pbClient.hWnd, sbClient.hWnd
pbClient.Min = 0
pbClient.Max = 100
pbClient.Value = 0
Set obj = New clsAsynch
End Sub
Private Sub Form_Resize()
' Move the progress bar to fit the pane of the client
With sbClient
pbClient.Move .Panels(2).Left, 10, .Panels(2).Width, .Height - 20
End With
End Sub
Sub obj_IAmWorkingOnIt(ByVal pc As Long, ByRef bCancel As Boolean)
If pc / 3 = Int(pc / 3) Then
sbClient.Panels(1).Text = ""
Else
sbClient.Panels(1).Text = "Working..."
End If
pbClient.Value = pc
bCancel = frmCancel.bCancel
End Sub
Sub obj_TaskComplete()
Unload frmCancel
Me.Enabled = True
sbClient.Panels(1).Text = ""
pbClient.Value = 0
pbClient.Visible = False
MsgBox "Asynchronous task is completed."
End Sub
Sub obj_Taskcancelled()
Unload frmCancel
Me.Enabled = True
sbClient.Panels(1).Text = ""
pbClient.Value = 0
pbClient.Visible = False
MsgBox "Asynchronous task is cancelled."
End Sub